//
//  UIButton+Extension.swift
//  HMWeibo
//
//  Created by HuaMou.Chen on 15/11/27.
//  Copyright © 2015年 HuaMou.Chen. All rights reserved.
//

import Foundation
import UIKit

extension UIButton {
    
    convenience init(imageName: String, backgroundImageName: String) {
        self.init()
        setImage(UIImage(named: imageName), forState: .Normal)
        setImage(UIImage(named: imageName + "_highlighted"), forState: .Highlighted)
        setBackgroundImage(UIImage(named: backgroundImageName), forState: .Normal)
        setBackgroundImage(UIImage(named: backgroundImageName + "_highlighted"), forState: .Highlighted)
        sizeToFit()
    }
    
    convenience init(title: String, fontSize: CGFloat, color: UIColor, imageName: String) {
        self.init()
        setTitle(title, forState: .Normal)
        setBackgroundImage(UIImage(named: imageName), forState: .Normal)
        titleLabel?.font = UIFont.systemFontOfSize(fontSize)
        setTitleColor(color, forState: .Normal)

        
    }
}